package edu.uts.reekie.designer.implementation.model.commands;


import edu.uts.reekie.designer.implementation.model.Connector;
import edu.uts.reekie.designer.implementation.model.Connector.Style;
import edu.uts.reekie.designer.model.AbstractDiagram;
import edu.uts.reekie.designer.model.ViewNode;

import org.eclipse.gef.commands.Command;
import org.eclipse.jface.fieldassist.DecoratedField;

public class ChangeConnectorHasPortCommand extends Command {

	private boolean newHasPortValue;
	private boolean oldHasPortValue;
	private Connector conn;
	
	public Connector getConnector(){
		return conn;
	}
	public void setConnector(Connector c) {
		conn = c;
		
	}
	
	public ChangeConnectorHasPortCommand(boolean hasPort){
		newHasPortValue = hasPort;
		
	}
	
	private void runy(boolean useNew){
		
boolean d = oldHasPortValue;
		if (useNew){
			d = newHasPortValue;
		}
		
		conn.setHasPort(d);
	}
	
	public void execute() {
		runy(true);
	}
	
	public void redo() {
		runy(true);
	}

	
	public void undo() {
		runy(false);
	}
}
